From f0ca3d47c31a4bc552042f4bd0c01619f2bda755 Mon Sep 17 00:00:00 2001 From: Lukas Schmelting Date: Fri, 5 Dec 2025 09:15:33 +0100 Subject: [PATCH] screenShield: Fix user deselection after idle in greeter When the session goes idle, _maybeCancelDialog() cancels any ongoing authentication dialog. Commit b16ee1a added code to grab focus after cancellation, ensuring it stayed on the lock screen curtain rather than wherever cancel() placed it. This was needed to handle keyboard events like Enter to raise the unlock dialog. Commit 727c84251 changed this to grab focus on the dialog itself, since the lock screen architecture had evolved. However, in the greeter case there is no separate curtain - the LoginDialog is shown directly and cancel() already restores focus to the user list via _showUserList(). The additional focus grab on the dialog container moved focus away from the selected user as soon as the screen began to dim, causing the username to appear deselected when returning from idle. Similarly, _ensureUnlockDialog() and _resetLockScreen() grabbed focus on the dialog container when the screen fully blanked, causing the same issue. For the greeter, replace grab_key_focus() with activate(), which delegates to LoginDialog.activate() and properly focuses the user list. For the unlock dialog, keep the original grab_key_focus() behavior - calling UnlockDialog.activate() would invoke _showPrompt(), which would interfere with commit 4bfa30085 that returns to the clock view after suspend. See-also: b16ee1a3a6c02facc803be45d2859e53c906decd See-also: 727c84251d6e536c5658962b4fd4ec89acdc832f See-also: 4bfa300850045dcd7c974bdd128adef13f2777b1 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1132 Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/599 Part-of: --- js/ui/screenShield.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 65f2e6227..6803d3f03 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -188,12 +188,6 @@ export class ScreenShield extends Signals.EventEmitter { return; this._dialog.cancel(); - if (this._isGreeter) { - // LoginDialog.cancel() will grab the key focus - // on its own, so ensure it stays on lock screen - // instead - this._dialog.grab_key_focus(); - } } _becomeModal() { @@ -455,7 +449,10 @@ export class ScreenShield extends Signals.EventEmitter { } this._dialog.allowCancel = allowCancel; - this._dialog.grab_key_focus(); + if (this._isGreeter) + this._dialog.activate(); + else + this._dialog.grab_key_focus(); return true; } @@ -495,7 +492,10 @@ export class ScreenShield extends Signals.EventEmitter { this._lockScreenShown({fadeToBlack, animateFade: false}); } - this._dialog.grab_key_focus(); + if (this._isGreeter) + this._dialog.activate(); + else + this._dialog.grab_key_focus(); } _lockScreenShown(params) { -- 2.39.5